Conversation
|
r? @chenyukang rustbot has assigned @chenyukang. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
I'll add tests for assembly output and for target incompatibility. |
This comment has been minimized.
This comment has been minimized.
|
|
||
| fn packed_stack_attr<'ll>(cx: &SimpleCx<'ll>, sess: &Session) -> Option<&'ll Attribute> { | ||
| if sess.target.arch != Arch::S390x { | ||
| return None; |
There was a problem hiding this comment.
Maybe panic here given that the frontend should already have emitted an error.
There was a problem hiding this comment.
hmm packed_stack_attr(...) is called every time llfn_attrs_from_instance is called indifferent of target arch.
And I think it would not be a good thing to add an arch check to llfn_attrs_from_instance as there are no other checks in that function. It blindly calls all possibilities and assumes that checks are already handled elsewhere.
5ddcabb to
4ebec9d
Compare
| If not specified, overflow checks are enabled if | ||
| [debug-assertions](#debug-assertions) are enabled, disabled otherwise. | ||
|
|
||
| ## packed-stack |
There was a problem hiding this comment.
Since the option isn't stable yet, this is the wrong place to document it I think?
There was a problem hiding this comment.
If i dont have packed-stack here x test tidy will complain. I try to find another location to do it.
There was a problem hiding this comment.
Something must be going wrong there. The page is explicitly about -C flags, not -Z flags.
There was a problem hiding this comment.
you where right. The error was not about my changes but about some uncommitted local changes. :( sorry
everything works as expected.
This comment has been minimized.
This comment has been minimized.
0d6d167 to
0c182af
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
0c182af to
7fef6ea
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
ok, i think most should be ok now. |
This comment has been minimized.
This comment has been minimized.
this enables packed-stack just as -mpacked-stack in clang and gcc. packed-stack is needed on s390x for kernel development.
7fef6ea to
31a40dc
Compare
| // we need to have access to the complete constructed `target` and the session options. | ||
| // this is the first place in the `run_compiler` flow where all this is available |
There was a problem hiding this comment.
This comment is very confusing when read outside the context of this PR.
| // we need to have access to the complete constructed `target` and the session options. | |
| // this is the first place in the `run_compiler` flow where all this is available | |
| // s390x: packed_stack + backchain only works with "softlofat" ABI. |
| @@ -72,7 +72,7 @@ pub(crate) fn add_configuration( | |||
|
|
|||
| /// Ensures that all target features required by the ABI are present. | |||
| /// Must be called after `unstable_target_features` has been populated! | |||
There was a problem hiding this comment.
| /// Must be called after `unstable_target_features` has been populated! | |
| /// Must be called after `unstable_target_features` has been populated! | |
| /// Also enforces other, target-specific constraints on how target features can be combined. | |
| /// (Those checks can only be done once the `Session` is mostly constructed, so there's | |
| /// no earlier place we can put them.) |
| if sess.target.arch == Arch::S390x | ||
| && sess.opts.unstable_opts.packed_stack | ||
| && sess.unstable_target_features.contains(&Symbol::intern(&"backchain")) | ||
| && sess.target.abi != Abi::SoftFloat |
There was a problem hiding this comment.
target.abi is just in charge of cfg(target_abi), it doesn't control the actual ABI. Please check rustc_abi which controls the actual ABI.
There was a problem hiding this comment.
Is this a new top-level test folder for such a small feature, with just a single test in it? That doesn't seem justified. Please move it to tests/ui/target-feature/, with a file name that indicates what it is about.
| #[derive(Diagnostic)] | ||
| #[diag("packedstack with backchain needs softfloat")] | ||
| #[note( | ||
| "enabling both `packedstack` and `backchain` attributes is incompatible with the default s390x target. Switch to s390x-unknown-none-softfloat if you need both attributes!" |
There was a problem hiding this comment.
| "enabling both `packedstack` and `backchain` attributes is incompatible with the default s390x target. Switch to s390x-unknown-none-softfloat if you need both attributes!" | |
| "enabling both `-Zpacked-stack` and the `backchain` target feature is incompatible with the default s390x ABI. Switch to s390x-unknown-none-softfloat if you need both attributes." |
| // this is the first place in the `run_compiler` flow where all this is available | ||
| if sess.target.arch == Arch::S390x | ||
| && sess.opts.unstable_opts.packed_stack | ||
| && sess.unstable_target_features.contains(&Symbol::intern(&"backchain")) |
There was a problem hiding this comment.
What happens if someone tries to enable backchain just for a particular function via #[target_feature] instead of -Ctarget-feature?
this enables
-Zpacked-stackjust as-mpacked-stackin clang and gcc. packed-stack is needed on s390x for kernel development.For reference: #151154 and #150766
look at @uweigand s post for full explanation of what this does. Here a wrap-up:
#150766 (comment)